const INFO = uni.getSystemInfoSync()

export const getStatusBarHeight = () => INFO.statusBarHeight || 16

export const getCapsuleBar = () => {
  if (!uni.getMenuButtonBoundingClientRect) {
    return { barHeight: 40, height: 32 }
  }

  const { top, height } = uni.getMenuButtonBoundingClientRect()
  return {
    barHeight: height + (top - INFO.statusBarHeight) * 2,
    height,
  }
}

export const getCustomBarHeight = () => {
  return getStatusBarHeight() + getCapsuleBar().barHeight
}

export const getLogoBarLeft = () => {
  // #ifdef MP-TOUTIAO
  const {
    iconLeft: { left, width },
  } = tt.getCapsuleBarHeight
  return left + width
  // #endif
  // #ifndef MP-TOUTIAO
  return 0
  // #endif
}
